﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AvantGameMachine.Events;
using Tao.FreeGlut;

namespace AvantGameMachine.Input.Keyboard
{
    class KeyboardManager
    {
        internal KeyboardManager()
        {
        }

        internal void RegisterCallbacks()
        {
            Glut.glutKeyboardFunc(new Glut.KeyboardCallback(keyboard));
            // Set window's to specialKey callback   
            Glut.glutSpecialFunc(new Glut.SpecialCallback(specialKey));
        }

        internal void keyboard(byte _key, int _x, int _y)
        {
            AGMPlatform.EManager.SendLocalInternalEvent(new Event(EventTypes.EVENT_TYPE_KEY, new KeyboardEventData(_key, 0, _x, _y, false, true)));
        }

        internal void specialKey(int _key, int _x, int _y)
        {
            AGMPlatform.EManager.SendLocalInternalEvent(new Event(EventTypes.EVENT_TYPE_KEY, new KeyboardEventData(0, _key, _x, _y, true, true)));
        }
    }
}
